package com.pay.demo.enums;

import lombok.Getter;

/**
 * @program: demo
 * @description: 支付状态枚举
 * @author: guoxh
 * @create: 2019-04-01 19:19
 **/
@Getter
public enum PayStatusEnum {

    CHUSHI(0, "初始"),
    CHUANGJIAN_DINGDAN_CHENGGONG(11, "创建订单成功"),
    CHUANGJIAN_DINGDAN_SHIBAI(12, "创建订单失败"),
    FASONG_DUANXIN_CHENGGONG(21, "发送短信成功"),
    FASONG_DUANXIN_SHIBAI(22, "发送短信失败"),
    SHOULI_CHENGGONG(31, "受理成功"),
    SHOULI_SHIBAI(32, "受理失败"),
    ZHIFU_CHENGGONG(41, "支付成功"),
    ZHIFU_SHIBAI(42, "支付失败");

    int code;
    String statusMsg;

    PayStatusEnum(int code, String statusMsg) {
        this.code = code;
        this.statusMsg = statusMsg;
    }

    public static PayStatusEnum getPayStatusEnum(int code) {
        for (PayStatusEnum itemEnum : PayStatusEnum.values()) {
            if (itemEnum.getCode() == code) {
                return itemEnum;
            }
        }
        return null;
    }
}
